﻿using System.Xml.Serialization;
using System.Xml;
using System.IO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PDOGenerator.Util;

namespace PDOGenerator.MapTypes
{

    public class SchemaMap
    {
        internal static SchemaMap CurrentSerial;

        public SchemaMap()
        {
            CurrentSerial = this;
            _Project = Project.CurrentSerial;
        }

        public SchemaMap(Project p)
        {
            _Project = p;
        }


        private Project _Project;
        [XmlIgnore]
        public Project Project
        {
            get { return _Project; }
        }


        private string _schemaName;
        public string SchemaName
        {
            get { return _schemaName; }
            set { _schemaName = value; }
        }

        private string _scriptOutputDirectory;
        public string ScriptOutputDirectory
        {
            get { return _scriptOutputDirectory; }
            set { _scriptOutputDirectory = value; }
        }

        private string _classOutputDirectory;
        public string ClassOutputDirectory
        {
            get { return _classOutputDirectory; }
            set { _classOutputDirectory = value; }
        }

        private string _subProjectName;
        public string SubProjectName
        {
            get { return _subProjectName; }
            set { _subProjectName = value; }
        }


        private SerialDictionary<string, TableMap> _Tables = new SerialDictionary<string, TableMap>();
        [XmlIgnore]
        public SerialDictionary<string, TableMap> Tables
        {
            get { return _Tables; }
            set { _Tables = value; }
        }

        [XmlIgnore]
        public List<TableMap> TableList
        {
            get { return _Tables.Values.ToList<TableMap>(); }
        }

        private bool _isPresentInDatabase;

        [XmlIgnore]
        public bool IsPresentInDatabase
        {
            get { return _isPresentInDatabase; }
            set { _isPresentInDatabase = value; }
        }

    }
}
